<?php
/*
Primary Author: Alex Arey 
Secondary: Derek Shue
Documentation: Cheng Yi
Updated: 12/10/2011
Module Description: The Internship Reference form is used by students to add 
reference contact information for their Internship Application(s).
*/
class Application_Form_InternshipReference extends Zend_Form
{

    public function init()
    {
    
    		$nameLenValid = new Zend_Validate_StringLength(array('max' => 30));
			$shortTextLenValid = new Zend_Validate_StringLength(array('max'=>8));
			$medTextLenValid = new Zend_Validate_StringLength(array('max' => 60));
			$longTextLenValid = new Zend_Validate_StringLength(array('max' => 120));
			$phonevalid = new Zend_Validate_Regex(array('pattern' => '/^\(\d\d\d\) ?\d\d\d-\d\d\d\d$/'));
			
		$this->setMethod('post');
		$this->addElement('text','referencename',array(
			'label' => 'Reference Name:',
			'filters' => array('StringTrim'),
			'validators'=>array($medTextLenValid),
	    	'required' => True,
			)
		);
		$this->addElement('text','referencephone',array(
			'label' => 'Reference Phone:',
			'filters' => array('StringTrim'),
			'validators' => array($phonevalid),
	    	'required' => True,
			)
		);
		$this->addElement('text','referenceaddr1',array(
			'label' => 'Reference Address Line 1:',
			'filters' => array('StringTrim'),
			'validators'=>array($medTextLenValid),
	    	'required' => True,
			)
		);
		$this->addElement('text','referenceaddr2',array(
			'label' => 'Reference Address Line 2:',
			'filters' => array('StringTrim'),
			'validators'=>array($medTextLenValid),
			)
		);
		$this->addElement('text','referencecity',array(
			'label' => 'Reference City:',
			'filters' => array('StringTrim'),
			'validators'=>array($nameLenValid),
	    	'required' => True,
			)
		);
		$this->addElement('text','referencestate',array(
			'label' => 'Reference State:',
			'filters' => array('StringTrim'),
			'validators'=>array($nameLenValid),
	    	'required' => True,
			)
		);
		$this->addElement('text','referencezip',array(
			'label' => 'Reference Zip:',
			'filters' => array('StringTrim'),
			'validators' => array('Digits', $shortTextLenValid),
	    	'required' => True,
			)
		);
		$this->addElement('text','referencerelation',array(
			'label' => 'Reference\'s relationship to applicant:',
			'filters' => array('StringTrim'),
			'validators'=>array($longTextLenValid),
	    	'required' => True,
			)
		);
		$this->addElement('submit','submit',array(
	 	   'label' => 'Add Reference')
		);
	}

}
?>
